<!DOCTYPE html>
<html lang="en">
<head>
    <title>Daily Record - Heart of Food</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.3/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
    <style>
        body { 
            background-color: #f8f9fa; 
            font-family: 'Inter', sans-serif; 
        }

        .main-container {
            max-width: 800px;
            margin: 3rem auto;
            padding: 2rem;
            background: white;
            border-radius: 20px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
        }

        /* 新增：图片选择区域样式 */
        .image-upload-container {
            margin: 1.5rem 0;
            text-align: center;
        }

        #selectImageBtn {
            background: #2a9d8f;
            color: white;
            padding: 0.8rem 1.5rem;
            border-radius: 25px;
            border: none;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        #selectImageBtn:hover {
            background: #268d81;
            transform: scale(1.02);
        }

        .food-image {
            max-width: 300px;
            height: auto;
            border-radius: 8px;
            border: 2px solid #e5e7eb;
            margin-top: 1rem;
            display: none; /* 默认隐藏，选择图片后显示 */
        }

        .no-image-tip {
            color: #6b7280;
            font-size: 0.9rem;
            margin-top: 1rem;
            display: none; /* 默认隐藏，无图片时显示 */
        }
    </style>
</head>
<body>
    <!-- Navbar Placeholder -->
    <nav id="navbarPlaceholder"></nav>

    <div class="container main-container">
        <h2>Daily Food Record</h2>

        <!-- 新增：图片选择按钮和预览区域 -->
        <div class="image-upload-container">
            <label id="selectImageBtn" class="btn">
                Select Food Image <i class="fas fa-image ms-2"></i>
                <input type="file" id="imageInput" accept="image/*" hidden>
            </label>
            <img src="" class="food-image" id="previewImage" alt="Selected Food Image">
            <p class="no-image-tip" id="noImageTip">No image selected</p>
        </div>

        <form id="recordForm">
            <div class="mb-3">
                <label class="form-label">Food Name</label>
                <input type="text" class="form-control" id="foodInput" required>
            </div>
            <div class="mb-3">
                <label class="form-label">Calories (kcal)</label>
                <input type="number" class="form-control" id="caloriesInput" min="0" required>
            </div>
            <div class="mb-3">
                <label class="form-label">Details</label>
                <textarea class="form-control" id="detailsInput" rows="3"></textarea>
            </div>
            <button type="submit" class="btn btn-primary">Save Record</button>
        </form>
    </div>

    <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/js/all.min.js"></script> <!-- 图标支持 -->
    <script src="./scripts/skeleton.js"></script>
    <script src="./scripts/post.js"></script>
</body>
</html>